#include <stdio.h>

int main()
{
    int val = fork();
    if(val)
    {
        printf("该进程为父进程，pid为：%d\n", getpid());
    }
    else if(val == 0)
    {
        printf("该进程为子进程，pid为：%d，ppid为：%d\n", getpid(), getppid());
    }
    else 
    {
        printf("出错！\n");
    }

    sleep(100);

    return 0;
}
